<template>
    <div class="loading-el" v-if="loading">
        <div class="loading-icon">
            <a-spin size="large"></a-spin>
        </div>
        <a-icon class="icon-close" type="close" @click="close" />
    </div>
</template>

<script>
    import {prefix} from '../config';
    export default {
        name: prefix + 'LoadingEl',
        props: {
            loading: {
                type: Boolean,
                default: false
            }
        },
        methods: {
            close () {
                this.$parent.loading = false;
                this.$emit('closeLoading');
            }
        }
    };
</script>

<style scoped lang="scss">
    .loading-el{
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        right: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.7);
        z-index: 999;
        .loading-icon{
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%,-50%);
            color: #fff;
        }
        .icon-close{
            position: absolute;
            right: 50px;
            top: 50px;
            font-size: 24px;
            color: #fff;
            cursor: pointer;
        }
    }
</style>
